package ua.pp.bizon.yandex.uploader.atom;

import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;

public class PhotosList implements Iterable<Photo> {

	private String autorName;
	private SortedSet<Photo> photos = new TreeSet<Photo>();

	public void addPhoto(Photo photo) {
		photos.add(photo);

	}

	public void setAutorName(String autorName) {
		this.autorName = autorName;
	}

	public String getAutorName() {
		return autorName;
	}

	public int size() {
		return photos.size();
	}

	@Override
	public Iterator<Photo> iterator() {
		return photos.iterator();
	}

	public Photo findPhoto(String id) {
		for (Photo p : photos) {
			if (p.getID().equals(id)) {
				return p;
			}
		}
		return null;
	}

}
